<?php

class model_firadio_php_sys_projmodule extends db {

    public function __construct() {
        //1：列表
        $table = "firphp_projmodule projmodule";
        $table.=" LEFT JOIN firphp_project project ON project.id=projmodule.projectid"; //连接【所属项目】
        $table.=" LEFT JOIN firphp_company company ON company.id=project.companyid"; //连接【所属公司】
        $db = db::getInstance();
        $this->firphp_projmodule = $db->table($table);
    }

    public function getList($projmoduleid = 0) {
        $field = array();
        $field['projmodule'] = 'id,name,title,enable,visible';
        //projmodule.id,name,projmodule.title,projmodule.enable,projmodule.visible
        $field2 = 'company.name companyname,project.name projectname';
        $wherestr = "1"; //初始化条件字符串
        $wherearr = array(); //初始化条件数组
        if ($projmoduleid > 0) {
            $wherestr.=" AND projmodule.id='{projmoduleid}'";
        }
        return($this->firphp_projmodule->field($field, $field2)->where($wherestr, $wherearr)->select());
    }

}
